package org.boulderfoodrescue.webapp.client.donors;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class MainDonorView extends Composite{

	private static MainLocationViewUiBinder uiBinder = GWT
			.create(MainLocationViewUiBinder.class);

	interface MainLocationViewUiBinder extends UiBinder<Widget, MainDonorView> {
	} 

	public MainDonorView(DonorRecipientInterface donorInterface) {
		locationTable = new DonorTable(donorInterface);
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiField(provided = true)
	DonorTable locationTable;
	@UiField
	Button createDonorButton;

	@UiHandler("createDonorButton")
	public void onCreateDonorButtonClick(ClickEvent event)
	{
		History.newItem("donorsNewDonor", true);
	}

	public DonorTable getDonorTable()
	{
		return locationTable;
	}
}
